package step_two;

public class maoPao {
    public static void main(String[] args) {
//        冒泡排序
        int query[] = {1, 5, 6, 2, 0, 14, 52, 32, 98};

        test(query);

        for (int j = 0; j <query.length; j++) {
            System.out.print(query[j]+" ");
        }

    }
    public static void test(int query[]){
        for (int i = 0; i < query.length - 1; i++) {
            boolean lock=true;//优化锁
            for (int j = 0; j <query.length-1; j++) {
                if (query[j]<query[j+1]){
                    lock=false;
                    int temp=query[j];
                    query[j]=query[j+1];
                    query[j+1]=temp;
                }
            }
            if (lock) break;
        }
    }

}
